package com.lzxuni.utils;

import org.apache.commons.lang.StringUtils;

import java.util.Arrays;

/**
 * @创建人 gyl
 * @Time 2018/10/31
 * @描述
 **/


public class Chongzushuju {
    public static String NewString(String userkey, String data) {
        String type = Chose(userkey);
        String[] shuju = {"0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"};
        String[] comedata = data.split(",");
        if (type.equals("1")) {
            shuju[0] = comedata[0];
            shuju[1] = comedata[1];
            shuju[2] = comedata[2];
            shuju[3] = comedata[3];
            shuju[4] = comedata[4];
            shuju[7] = comedata[5];

        } else if (type.equals("2")) {
            shuju[0] = comedata[0];
            shuju[1] = comedata[1];
            shuju[2] = comedata[2];
            shuju[5] = comedata[3];
            shuju[6] = comedata[4];
            shuju[7] = comedata[5];
            shuju[8] = comedata[6];
        } else if (type.equals("3")) {
            shuju[3] = comedata[0];
            shuju[4] = comedata[1];
            shuju[9] = comedata[2];
            shuju[10] = comedata[3];
            shuju[11] = comedata[4];
            shuju[12] = comedata[5];

        } else if (type.equals("4")) {
            shuju[0] = comedata[0];
            shuju[1] = comedata[1];
            shuju[2] = comedata[2];
            shuju[3] = comedata[3];
            shuju[4] = comedata[8];
            shuju[5] = comedata[17];
            shuju[6] = comedata[18];
            shuju[7] = comedata[19];
            shuju[8] = comedata[20];
            shuju[9] = comedata[13];
            shuju[10] = comedata[14];
            shuju[11] = comedata[15];
            shuju[12] = comedata[16];
            shuju[14] = comedata[4];
            shuju[15] = comedata[5];
            shuju[16] = comedata[6];
            shuju[17] = comedata[7];
            shuju[18] = comedata[9];
            shuju[19] = comedata[10];
            shuju[20] = comedata[11];
            shuju[21] = comedata[12];

        } else if (type.equals("5")) {
            shuju[0] = comedata[0];
            shuju[1] = comedata[1];
            shuju[2] = comedata[2];
            shuju[3] = comedata[4];
            shuju[4] = comedata[5];
            shuju[5] = comedata[10];
            shuju[6] = comedata[11];
            shuju[7] = comedata[7];
            shuju[8] = comedata[12];
            shuju[9] = comedata[8];
            shuju[10] = comedata[9];
            shuju[11] = comedata[6];
            shuju[13] = comedata[3];

        } else if (type.equals("6")) {
            shuju[0] = comedata[0];
            shuju[1] = comedata[2];
            shuju[3] = comedata[3];
            shuju[4] = comedata[4];
            shuju[9] = comedata[1];
            shuju[10] = comedata[7];
            shuju[11] = comedata[5];
            shuju[12] = comedata[6];

        } else if (type.equals("7")) {
            shuju[0] = comedata[0];
            shuju[1] = comedata[1];
            shuju[9] = comedata[2];
            shuju[10] = comedata[3];
            shuju[11] = comedata[4];
            shuju[12] = comedata[5];

        } else if (type.equals("8")) {
            shuju[0] = comedata[0];
            shuju[1] = comedata[2];
            shuju[4] = comedata[3];
            shuju[9] = comedata[1];
            shuju[10] = comedata[6];
            shuju[11] = comedata[4];
            shuju[12] = comedata[5];

        } else if (type.equals("9")) {
            shuju[0] = comedata[0];
            shuju[1] = comedata[1];
            shuju[3] = comedata[2];
            shuju[4] = comedata[3];
            shuju[5] = comedata[5];
            shuju[6] = comedata[6];
            shuju[8] = comedata[7];
            shuju[13] = comedata[4];

        } else if (type.equals("10")) {
            shuju[0] = comedata[0];
            shuju[1] = comedata[1];
            shuju[2] = comedata[2];
            shuju[3] = comedata[3];
            shuju[4] = comedata[4];
            shuju[5] = comedata[5];
            shuju[6] = comedata[6];
            shuju[7] = comedata[7];
            shuju[8] = comedata[8];
        }else{
            for(int i=0;i<comedata.length;i++){
                shuju[i] = comedata[i];
            }


        }

        return StringUtils.join(shuju, ",");
    }


    public static String Chose(String userkey) {
        String type = "";
        switch (userkey) {
            case "17042739005":
                type = "1";
                break;
            case "17042739002":
                type = "1";
                break;
            case "17042739001":
                type = "1";
                break;
            case "17042739003":
                type = "1";
                break;
            case "17042739004":
                type = "1";
                break;
            case "17042739006":
                type = "1";
                break;
            case "18074919001":
                type = "2";
                break;
            case "18074919002":
                type = "2";
                break;
            case "18074919003":
                type = "3";
                break;
            case "17083257001":
                type = "4";
                break;
            case "17083257002":
                type = "4";
                break;
            case "20160918001":
                type = "5";
                break;
            case "20160918003":
                type = "5";
                break;
            case "20160918002":
                type = "5";
                break;
            case "20160919005":
                type = "6";
                break;
            case "20160919003":
                type = "6";
                break;
            case "20160919002":
                type = "6";
                break;
            case "20160919004":
                type = "6";
                break;
            case "18074919004":
                type = "7";
                break;
            case "20160919001":
                type = "8";
                break;
            case "20160921002":
                type = "9";
                break;
            case "20160921001":
                type = "9";
                break;
            case "20160921003":
                type = "9";
                break;
            case "20160921004":
                type = "9";
                break;
            case "17062988003":
                type = "10";
                break;
            case "16081508002":
                type = "10";
                break;
            case "20160726010":
                type = "10";
                break;
            case "17062988002":
                type = "10";
                break;
            case "17042657005":
                type = "10";
                break;
            case "17042657003":
                type = "10";
                break;
            case "16051051001":
                type = "10";
                break;
            case "20160617007":
                type = "10";
                break;
            case "17042657001":
                type = "10";
                break;
            case "18064780003":
                type = "10";
                break;
            case "18064780002":
                type = "10";
                break;
            case "18064780001":
                type = "10";
                break;
            case "20160617004":
                type = "10";
                break;
            case "17062988001":
                type = "10";
                break;
            case "20160617005":
                type = "10";
                break;
            case "20160726013":
                type = "10";
                break;
            case "17042657002":
                type = "10";
                break;
            case "20160617002":
                type = "10";
                break;
            case "20160617006":
                type = "10";
                break;
            case "16081508001":
                type = "10";
                break;
            case "16051051000":
                type = "10";
                break;
            case "17042657006":
                type = "10";
                break;
            case "20160726011":
                type = "10";
                break;
            case "20160617003":
                type = "10";
                break;
            case "20160726012":
                type = "10";
                break;
            case "20160726014":
                type = "10";
                break;
            case "17042657004":
                type = "10";
                break;
            default:
                type = "11";
                break;

        }


        return type;
    }


}
